package cn.com.bluemoon.daps.model.service.impl;


import cn.com.bluemoon.daps.common.enums.BmStatus;
import cn.com.bluemoon.daps.model.dto.UnRelationDto;
import cn.com.bluemoon.daps.model.entity.DapDataModelRelatedStandardResult;
import cn.com.bluemoon.daps.model.mapper.DapDataModelRelatedStandardResultMapper;
import cn.com.bluemoon.daps.model.service.DapDataModelRelatedStandardResultService;
import cn.com.bluemoon.daps.model.vo.SearchRelationVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 关联标准结果表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2020-08-07
 */
@Slf4j
@Service
public class DapDataModelRelatedStandardResultServiceImpl extends ServiceImpl<DapDataModelRelatedStandardResultMapper, DapDataModelRelatedStandardResult> implements DapDataModelRelatedStandardResultService {


    @Resource
    DapDataModelRelatedStandardResultMapper mapper;

    /**
     * 未关联的标准的字段(分页)
     * @param searchRelationVo
     * @return
     */
    @Override
    public IPage<UnRelationDto> getUnRelationPage(SearchRelationVo searchRelationVo) {

        Page<UnRelationDto> page = new Page<>(searchRelationVo.getPageNum(),searchRelationVo.getPageSize());
        IPage<UnRelationDto> iPage = mapper.selectUnRelationPage(page, searchRelationVo, BmStatus.ON.getCode());
        return iPage;
    }

    /**
     * 已关联的标准的字段(分页)
     * @param searchRelationVo
     * @return
     */
    @Override
    public IPage<UnRelationDto> getRelationPage(SearchRelationVo searchRelationVo) {

        Page<UnRelationDto> page = new Page<>(searchRelationVo.getPageNum(),searchRelationVo.getPageSize());
        IPage<UnRelationDto> iPage = mapper.selectRelationPage(page, searchRelationVo, BmStatus.ON.getCode());
        return iPage;
    }

    /**
     * 获得未匹配和忽略列表
     * @param searchRelationVo
     * @return
     */
    @Override
    public IPage<UnRelationDto> getUnMatchAndIgnore(SearchRelationVo searchRelationVo) {

        Page<UnRelationDto> page = new Page<>(searchRelationVo.getPageNum(),searchRelationVo.getPageSize());
        IPage<UnRelationDto> iPage = mapper.selectUnMatchAndIgnore(page, searchRelationVo, BmStatus.ON.getCode());
        return iPage;
    }
}
